/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaproject;

import Tables.WhereEnum;
import Tables.database.Teacher;
import Tables.database.User;
import databaseHandler.DatabaseHandler;
import former.AbstractConditionalFormer;
import former.AbstractFormer;
import former.queryFormers.DeleteFormer;
import former.queryFormers.InsertFormer;
import former.queryFormers.UpdateFormer;
import former.queryFormers.selectFormer;
import java.beans.PropertyDescriptor;
import java.sql.SQLException;
import java.util.Calendar;

/**
 *
 * @author FOE
 */
public class JavaProject {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException, Exception {
          DatabaseHandler handler=new DatabaseHandler("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@127.0.0.1:1521:XE","mahdi","12345678",10);
          User user=new User();
          Teacher t=new Teacher(1,12,"test");
          t.where="id=1";
          t.whereCondition=WhereEnum.where;
          boolean insert = handler.insert(t);
          //user.where="id = 1";
          handler.select(t);
          //handeler.test();
          //        User user=new  User(1, "mohamed", "hello.java", "1234", Calendar.getInstance().getTime());
//        AbstractFormer inserter=new InsertFormer();
//        user.isCustom=true;
//        String[] cols={"userName","birthDate"};
//        user.customizedColumns=cols;
//        System.out.println(inserter.formQuery(user));
//        user.isCustom = false;
//        System.out.println(inserter.formQuery(user));
//        AbstractConditionalFormer update=new UpdateFormer();
//        System.out.println(update.formQuery(user, "id=0 and name='hello'"));
//        System.out.println(update.formQuery(user));
//        AbstractConditionalFormer select=new selectFormer();
//        System.out.println(select.formQuery(user,"id=10 and password=20"));
//        System.out.println(select.formQuery(user));
//        AbstractConditionalFormer delete=new DeleteFormer();
//        System.out.println(delete.formQuery(user,"id=10 and password=20"));
//        System.out.println(delete.formQuery(user));

    }
}
